package gspushmq.v1.websocket.core;

import java.net.UnknownHostException;

import org.java_websocket.WebSocketImpl;

import ggframework.util.GGConfigurer;
import gspushmq.util.GGLogger;
import gspushmq.v1.websocket.GGWebSocketImpl;

public class GGWebSocketBuilder {
	
	public static void start() {
		WebSocketImpl.DEBUG = GGConfigurer.getBoolean("ggpush.isdebug", false);
		int port = GGConfigurer.getInteger("ggpush.port", 8099); // 8099 flash policy port
		try {
			GGPusherEnum.pusher.init(new GGWebSocketImpl(port));
			GGLogger.warn(GGWebSocketBuilder.class, "--GGWebSocketBuilder--init");
		} catch (UnknownHostException e) {
			GGLogger.error(GGWebSocketBuilder.class, e, "创建GGWebSocket连接异常");
		}
	}
	
	public static void destory() {
		GGPusherEnum.pusher.destory();
	}
}
